from flask import Flask, render_template, redirect, url_for, request, jsonify
from flask_sqlalchemy import SQLAlchemy

from datetime import datetime

import os

app = Flask(__name__, static_url_path='')
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///./db/myblog.db'
app.config['SQLALCHEMY_ECHO'] = False
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
app.secret_key = 'saf678sf97as6fsaf670*^&(*$%('
db = SQLAlchemy(app)

from myblog import blog
# 注册blog蓝图
app.register_blueprint(blog, url_prefix='/blog')

from mylink import my_info
# 注册个人信息蓝图
app.register_blueprint(my_info, url_prefix='/myinfo')

from blogmanage import manage
# 注册控制模块蓝图
app.register_blueprint(manage, url_prefix='/manage')

from reguser import admin
# 注册账号管理蓝图
app.register_blueprint(admin, url_prefix='/user')

from ueditormanage import ueditor
# 注册ueditor编辑器后台蓝图
app.register_blueprint(ueditor)


@app.route('/')
def hello_world():
    return redirect(url_for('blog.blog_index'))


@app.route('/404/')
def error():
    return render_template('404.html')


@app.route('/about/')
def about():
    return render_template('about.html')


@app.route('/waring/')
def waring():
    return render_template('waring.html')






if __name__ == '__main__':
    app.run()
